{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Vector Norms"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Computing norms by hand\n",
        "\n",
        "$p$-norms can be computed in two different ways in numpy:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import numpy as np\n",
        "import numpy.linalg as la"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "x = np.array([1.,2,3])"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "First, let's compute the 2-norm by hand:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "3.7416573867739413"
            ]
          },
          "execution_count": 3,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "np.sum(x**2)**(1/2)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Next, let's use `numpy` machinery to compute it:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "3.7416573867739413"
            ]
          },
          "execution_count": 4,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "la.norm(x, 2)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Both of the values above represent the 2-norm: $\\|x\\|_2$."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "--------------\n",
        "\n",
        "## About the $\\infty$-norm\n",
        "\n",
        "Different values of $p$ work similarly:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "3.0773848853940629"
            ]
          },
          "execution_count": 5,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "np.sum(np.abs(x)**5)**(1/5)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "3.0773848853940629"
            ]
          },
          "execution_count": 6,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "la.norm(x, 5)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "---------------------\n",
        "\n",
        "The $\\infty$ norm represents a special case, because it's actually (in some sense) the *limit* of $p$-norms as $p\\to\\infty$.\n",
        "\n",
        "Recall that: $\\|x\\|_\\infty = \\max(|x_1|, |x_2|, |x_3|)$.\n",
        "\n",
        "Where does that come from? Let's try with $p=100$:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "array([  1.00000000e+00,   1.26765060e+30,   5.15377521e+47])"
            ]
          },
          "execution_count": 7,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "x**100"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "5.1537752073201132e+47"
            ]
          },
          "execution_count": 8,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "np.sum(x**100)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Compare to last value in vector: the addition has essentially taken the maximum:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "3.0"
            ]
          },
          "execution_count": 9,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "np.sum(x**100)**(1/100)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Numpy can compute that, too:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "3.0"
            ]
          },
          "execution_count": 10,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "la.norm(x, np.inf)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "-------------\n",
        "\n",
        "## Unit Balls\n",
        "\n",
        "Once you know the set of vectors for which $\\|x\\|=1$, you know everything about the norm, because of semilinearity. The graphical version of this is called the 'unit ball'.\n",
        "\n",
        "We'll make a bunch of vectors in 2D (for visualization) and then scale them so that $\\|x\\|=1$."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 26,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "(-1.5, 1.5)"
            ]
          },
          "execution_count": 26,
          "metadata": {},
          "output_type": "execute_result"
        },
        {
          "data": {
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAREAAAEACAYAAACUHkKwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHhtJREFUeJzt3XmUVPWZ//H30+wC0myispqoQdwazRCCUVo9LkRjG4JL\noqOdRaOJMSQ5J6jjRHOck8RZfjGJOjOiEc2MgyYnKpi4Q6lIVAy2bLKIgIAIqLQKNNB0P78/vlXQ\n0F1dt+vequ+3iud1Tp2qW3W77qeqq56636fuvSWqijHG5KvCdwBjTGmzImKMicWKiDEmFisixphY\nrIgYY2KxImKMiSWRIiIi94nIRhFZkOX28SJSLyLz06ebk1iuMca/zgndz/3A74AH25nnRVW9IKHl\nGWMCkciaiKrOAbbkmE2SWJYxJizF7ImMFZE3ROQvIjKqiMs1xhRQUsOZXP4ODFfV7SIyAXgMOLpI\nyzbGFFBRioiqbm1x+UkRuVtE+qnqR/vPKyK2M48xnqhqh9sOSQ5nhCx9DxEZ1OLyGEDaKiAZqhrU\n6ZZbbvGewTKVT6ZQc+UrkTUREXkIqA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gGbCi0LmAfsBz6eU9A1Sm\nrz8ZuCd9+YvAgvRz9SZQW6AsrR43bivk89OXuwGPpG9/BRhRhP9Zrky/wH34vAE8DxxdhEwPAe8B\nO4F3gW8C3wWubjHPnbhvlt6knW8oi5UJ+H6L52ku8IVc92kbmxljYglpOGOMKUFWRIwxsVgRMcbE\nYkXEGBOLFRFjTCxWRIwxsVgRMcbEYkXEGBPL/wfrar+/+XGlfgAAAABJRU5ErkJggg==\n",
            "text/plain": [
              "<matplotlib.figure.Figure at 0x7f82450f8278>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "alpha = np.linspace(0, 2*np.pi, 2000, endpoint=True)\n",
        "x = np.cos(alpha)\n",
        "y = np.sin(alpha)\n",
        "\n",
        "vecs = np.array([x,y])\n",
        "\n",
        "p = 5\n",
        "norms = np.sum(np.abs(vecs)**p, axis=0)**(1/p)\n",
        "norm_vecs = vecs/norms\n",
        "\n",
        "import matplotlib.pyplot as pt\n",
        "pt.grid()\n",
        "pt.gca().set_aspect(\"equal\")\n",
        "pt.plot(norm_vecs[0], norm_vecs[1])\n",
        "pt.xlim([-1.5, 1.5])\n",
        "pt.ylim([-1.5, 1.5])"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": true
      },
      "outputs": [],
      "source": []
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.5.0+"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}